'Animals Amendment Submission
Option Strict Off
imports System
imports PHSRAG.Insight21.Humans
imports PHSRAG.Insight21.BusinessObjects
imports FormsManagement = PHSRAG.Insight21.FormsManagement
imports System.Collections
imports CDS = PHSRAG.Insight21.CDS

module Script
    sub Main()
    
        ' cast RexParams to an AnimalsRexParams.
        
        Dim questionnaireAnswers As new ArrayList()
        Dim qV As FormsManagement.QuestionnaireVersion
        Dim questionnaireAnswer As FormsManagement.QuestionnaireAnswer

        'IACUC is a required board        
        Dim iacucBoardReview as AnimalsRexParams.BoardReview = new AnimalsRexParams.BoardReview
        rexParams.BoardReviews.Add (iacucBoardReview)
        iacucBoardReview.Period = 1
        iacucBoardReview.DocumentType = "Initial Review"
        iacucBoardReview.MailGroupId = 8 'IACUC MailGroupId
        iacucBoardReview.ReviewType = ""
        iacucBoardReview.BoardStatus = "Pending"
        iacucBoardReview.OverallStatus = "Pending IACUC"
        iacucBoardReview.CurrentStatus = true
        iacucBoardReview.Note = ""
        iacucBoardReview.RTFNote = ""
        iacucBoardReview.StaffNote = ""
        iacucBoardReview.StaffNoteRTF = ""

		dim overallStatus as string = "Pending IACUC"
        questionnaireAnswers= currentProtVersion.QuestionnaireAnswers
        For Each questionnaireAnswer In questionnaireAnswers
            
            qV  = questionnaireAnswer.QuestionnaireVersion
            Dim answers as new ArrayList()
            
            ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            '  AMENDMENT
            '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
            If (qV.Questionnaire.Name = "IACUCAmendment") Then
                
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("TopChoice")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "Y" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Study Staff"
                                Dim staffAnswers as new ArrayList()
                                    rexParams.AnnReviewNotes = string.empty
                                    'Add to Notes tab in Rex
                                     staffAnswers = questionnaireAnswer.GetAnswers("NewPI")
                                     if not staffAnswers is nothing then 
                                        if staffAnswers.Count > 0 then                                    
                                            rexParams.AnnReviewNotes += "<br> Adding new PI<br>" + staffAnswers(0).value
                                        end if
                                     end if
                                     staffAnswers = nothing
                                     staffAnswers = questionnaireAnswer.GetAnswers("AddStaff")
                                     if not staffAnswers is nothing then
                                        if staffAnswers.Count > 0 then
                                             rexParams.AnnReviewNotes += "<br> Added the following staff(s):"
                                                for each names as FormsManagement.Answer in staffAnswers
                                                    rexParams.AnnReviewNotes += names.Value
                                                next
                                        end if
                                     end if
                                     staffAnswers = nothing
                                     staffAnswers = questionnaireAnswer.GetAnswers("DelStaff")
                                     if not staffAnswers is nothing then
                                         if staffAnswers.Count > 0 then
                                            rexParams.AnnReviewNotes += "<br> Removed the following staff(s):"
                                                for each names as FormsManagement.Answer in staffAnswers
                                                     rexParams.AnnReviewNotes += names.Value
                                                next
                                        end if                                     
                                    end if					
                            end if
                        end if
                    end if
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComSponsor")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                            rexParams.ComponentsToChange.Add ( newComponent )
                            newComponent.Component = "Sponsor or Funding Source"
                        end if
                    end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComTitle")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Title Change"
                            'end if					
                        end if
                    end if

                    if questionnaireAnswer.GetAnswerValue("InsightProd") = "N" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Conversion to eIACUC"
                    end if

                    if questionnaireAnswer.GetAnswerValue("AnimHouse") = "Y" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Housing"
                    end if

                    if questionnaireAnswer.GetAnswerValue("Additional") = "Y" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Number of Animals"
                    end if

                    if questionnaireAnswer.GetAnswerValue("ComAbstract") = "ABSTRACT" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Abstract"
                    end if

                    if questionnaireAnswer.GetAnswerValue("ComDetailed") = "DETAILS" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Detailed Research Plan"
                    end if

                    if questionnaireAnswer.GetAnswerValue("ComOther") = "OTHER" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Other"
                    end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComProcedure")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "PROCEDURE" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Procedures (Surgical and Non-Surgical)"
                            end if					
                        end if
                    end if
                    
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComDrugs")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "DRUGS" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Drugs/Material Injected"
                            end if					
                        end if
                    end if
                    
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComDevice")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "DEVICE" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Devices Used in Animals"
                            end if					
                        end if
                    end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComAnesthesia")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "ANESTHESIA" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Anesthetic/Analgesic Regimen"
                            end if					
                        end if
                     end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComDuration")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "DURATION" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Survival Duration"
                            end if					
                        end if
                    end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComEuthan")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "EUTHANASIA" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Euthanasia"
                            end if					
                        end if
                    end if

                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComTumor")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "TUMOR" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Tumor Production"
                            end if					
                        end if
                    end if
                    
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComAscites")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "ASCITES" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Antibody or Ascites Production"
                            end if					
                        end if
                    end if
                    
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComBreeding")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "BREED" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Breeding"
                            end if					
                        end if
                    end if
                    
                    answers = nothing
                    answers = questionnaireAnswer.GetAnswers("ComFluid")
                    if not answers is nothing then
                        if ( answers.Count > 0) then
                            Dim singleAnswer as FormsManagement.Answer = answers(0)
                            if singleAnswer.Value = "FLUID" then
                                Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                                rexParams.ComponentsToChange.Add ( newComponent )
                                newComponent.Component = "Food/Fluid Restriction"
                            end if					
                        end if
                    end if
                    
                    if questionnaireAnswer.GetAnswerValue("SSB") = "Y" then
                        Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                        rexParams.ComponentsToChange.Add ( newComponent )
                        newComponent.Component = "Strain"
                    end if

            ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'  Hazardous Agent Administration and Use
			''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''          
            else If qV.Questionnaire.Name = "Hazardous Agent Administration and Use"
                answers = nothing
                answers = questionnaireAnswer.GetAnswers("HazardType")
                if ( answers.Count > 0) then
                    Dim newComponent as RexParams.ComponentToChange = new RexParams.ComponentToChange
                    rexParams.ComponentsToChange.Add ( newComponent )

                    Dim singleAnswer as FormsManagement.Answer = answers(0)
                    Select Case singleAnswer.Value
                        Case "Bio"
                            newComponent.Component = "Biological Agents"
                        Case "Chem"
                            newComponent.Component = "Toxic Chemicals/Carcinogens"
                        Case "Rad"
                            newComponent.Component = "Radioisotopes"
                    End Select
                end if
          
            ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'  STANDARD APPLICATION
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
			else If (qV.Questionnaire.Name = "Standard Application") 
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("Resubmission")
				    If (answers.Count > 0) Then
	                	    Dim resub as FormsManagement.Answer = answers(0)
				        if resub.Value = "Y" then
					        rexParams.Resubmission = true
				        else	
					        rexParams.Resubmission = false
				        end if
				    End If
				
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("PreviousProtocol")
				    If (answers.Count > 0) Then
				        Dim prevProt as FormsManagement.Answer = answers(0)
				        Dim val as string = prevProt.Value
				        rexParams.PreviousFolderNumber = Left(val, 13)
				    End If
				
		            AddArrayListItem( questionnaireAnswer, "Ascites", "ASCITES", rexParams.Considerations, "Ascites production" )
		            AddArrayListItem( questionnaireAnswer, "Tumor", "TUMOR", rexParams.Considerations, "Tumor growth" )
		            AddArrayListItem( questionnaireAnswer, "LD50", "LD50", rexParams.Considerations, "Death as an endpoint (i.e. LD50)" )
		            AddArrayListItem( questionnaireAnswer, "Burns", "BURNS", rexParams.Considerations, "Burns or trauma" )
		            AddArrayListItem( questionnaireAnswer, "Device", "DEVICE", rexParams.Considerations, "Device evaluation" )
		            AddArrayListItem( questionnaireAnswer, "Tran", "TRAN", rexParams.Considerations, "Transportation between non-MGH facilities" )
		            AddArrayListItem( questionnaireAnswer, "IntraTran", "INTRATRAN", rexParams.Considerations, "Transportation between MGH facilities" )
		            AddArrayListItem( questionnaireAnswer, "OffSiteHousing", "NONMGH", rexParams.Considerations, "Housing at non-MGH facilities" )
		            AddArrayListItem( questionnaireAnswer, "Surgery", "Sx", rexParams.Considerations, "Survival Surgery" )
		            AddArrayListItem( questionnaireAnswer, "SxProcedures", "MxSx", rexParams.Considerations, "Multiple survival operative procedures" )
		            AddArrayListItem( questionnaireAnswer, "Paralytic", "PARALYTICS", rexParams.Considerations, "Paralytic agents" )
		            AddArrayListItem( questionnaireAnswer, "Fluid", "FLUID", rexParams.Considerations, "Food or water deprivation" )
		            AddArrayListItem( questionnaireAnswer, "PainStudy", "PAIN", rexParams.Considerations, "Study of pain or stress" )
		            AddArrayListItem( questionnaireAnswer, "UnPain", "UNPAIN", rexParams.Considerations, "Unalleviated pain or distress" )
    				AddArrayListItem( questionnaireAnswer, "Breed", "BREED", rexParams.Considerations, "Breeding Colony" )
				
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Housing
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''	  
            Else If (qv.Questionnaire.Name = "Housing") Then
            
				answers = questionnaireAnswer.GetAnswers("Breed")
				If (answers.Count > 0) Then
                    Dim breed as FormsManagement.Answer = answers(0)
                    if breed.Value = "BREED" then
                        rexParams.Considerations.Add("Breeding Colony")
                    end if
				End If

				answers = questionnaireAnswer.GetAnswers("Immuno")
				If (answers.Count > 0) Then
	                	Dim husbImmune as FormsManagement.Answer = answers(0)
				    if husbImmune.Value = "IMMUNO" then
					    rexParams.specialHandling.Add("ImmunoSuppresed")
				    end if
				End If

				answers = questionnaireAnswer.GetAnswers("GMA")
				If (answers.Count > 0) Then
	               		 Dim husbandGenetic as FormsManagement.Answer = answers(0)
				    if husbandGenetic.Value = "GMA" then
					    rexParams.specialHandling.Add("Transgenic")
				    end if
				End If
				
				answers = questionnaireAnswer.GetAnswers("OTR")
				If (answers.Count > 0) Then
	               		 Dim husbandGenetic as FormsManagement.Answer = answers(0)
				    if husbandGenetic.Value = "OTR" then
					    rexParams.specialHandling.Add("Knock-outs")
				    end if
				End If

				answers = questionnaireAnswer.GetAnswers("Housing")
				If (answers.Count > 0) Then
				    Dim housingAnswer As FormsManagement.Answer
					For Each housingAnswer In answers
						if  housingAnswer.Value = "114CNY1"  Then
						    rexParams.HousingLocation.Add ( "114" )	
						else if  housingAnswer.Value = "149CNY8"  Then
						    rexParams.HousingLocation.Add ( "149-8" )	
						else if  housingAnswer.Value = "149CNY9"  Then
						    rexParams.HousingLocation.Add ( "149-9" )	
						else if  housingAnswer.Value = "65LANDS"  Then
						    rexParams.HousingLocation.Add ( "(Other)" )    						    
                            ' also add in the other description.
                            	rexParams.HousingLocationOther = "65 Landsdowne"
						else if  housingAnswer.Value = "COX7"  Then
						    rexParams.HousingLocation.Add ( "COX-7" )	
						else if  housingAnswer.Value = "EDWARDS6"  Then
						    rexParams.HousingLocation.Add ( "EDR-6" )	
						else if  housingAnswer.Value = "SHRINERS"  Then
						    rexParams.HousingLocation.Add ( "SBI" )	
						else if  housingAnswer.Value = "SIMCHES8"  Then
						    rexParams.HousingLocation.Add ( "CPZ-8" )
						else if  housingAnswer.Value = "THIER8"  Then
						    rexParams.HousingLocation.Add ( "Thier-8" )	
						else if  housingAnswer.Value = "THIERB1"  Then
						    rexParams.HousingLocation.Add ( "Thier-B" )
						else if  housingAnswer.Value = "WHITE5"  Then
						    rexParams.HousingLocation.Add ( "WHT-5" )
						else if  housingAnswer.Value = "75CNY"  Then
						    rexParams.HousingLocation.Add ( "75" )
						else if  housingAnswer.Value = "114CNY1"  Then
						    rexParams.HousingLocation.Add ( "114" )
						else if  housingAnswer.Value = "OTHERHSE"  Then
						    rexParams.HousingLocation.Add ( "(Other)" )    						    
                            ' also add in the other description.
                            Dim housingOtherAnswers as new ArrayList()
				            housingOtherAnswers = questionnaireAnswer.GetAnswers("OtrHouse")   
                            If (answers.Count > 0) Then
				                 Dim housingOtherAnswer As FormsManagement.Answer = housingOtherAnswers(0)
				                 rexParams.HousingLocationOther = housingOtherAnswer.Value
				            End If
						end if
					Next
				End If
				
				answers = questionnaireAnswer.GetAnswers("LabHouse") 
				If (answers.Count > 0) Then
			        Dim housing as FormsManagement.Answer = answers(0)
				    if housing.Value = "Y" then
					    rexParams.HousingOver12 = true
				    else	
					    rexParams.HousingOver12 = false
				    end if
				End If

				Dim labLocation as AnimalsRexParams.LabLocation
		        Dim buildingAnswer As FormsManagement.Answer					   
		        answers = questionnaireAnswer.GetAnswers("locat") 
	            If (answers.Count > 0) Then
	                For Each buildingAnswer In answers
	                    if buildingAnswer.Value <> nothing and buildingAnswer.Value <> string.Empty then
	                            labLocation = new AnimalsRexParams.LabLocation				                        			                    				    
	                            labLocation.BuildingCode =  buildingAnswer.Value				                             
	                            if buildingAnswer.Value = "CNY114" then        				                       
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("CNY114")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If 
	                            else if buildingAnswer.Value = "CNY149" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("CNY149")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "CNY75" then
	                                    buildingAnswer.Value = "75"
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("CNY75")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "BAR" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("BAR")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "BHX" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("BHX")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "BLK" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("BLK")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "BUL" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("BUL")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "COX" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("COX")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "CPZ" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("CPZ")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "EDR" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("EDR")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "ELL" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("ELL")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "FND" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("FND")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "GRB" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("GRB")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "GRJ" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("GRJ")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "SHR" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("SHR")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "THR" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("THR")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "VBK" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("VBK")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "WHT" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("WHT")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            else if buildingAnswer.Value = "WRN" then
	                                    rexParams.LabLocations.Add (labLocation)	
	                                    Dim roomAnswers as new ArrayList()
	                                    roomAnswers = questionnaireAnswer.GetAnswers("WRN")
	                                    If ( roomAnswers.Count > 0) Then
	                                        Dim room as FormsManagement.Answer = roomAnswers(0)
	                                        labLocation.RoomNumber = room.Value				                                        
	                                    End If
	                            end if				                            
	                   end if
	                Next			
		        End If

			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Tumor Production
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''	  
		    Else If (qV.Questionnaire.Name = "Tumor Production") Then
		  
                Dim refCodes as CDS.RefCodes = new CDS.RefCodes(cachePolicy)
                refCodes.Load(connectionString, Nothing)

		        Dim newTumorLine as AnimalsRexParams.TumorCellLine = new AnimalsRexParams.TumorCellLine
				rexParams.TumorCellLines.Add (newTumorLine)
					
                newTumorLine.TumorCellLineName = questionnaireAnswer.GetAnswerValue("Tumor") 
				
				Dim rodOrigin as string = questionnaireAnswer.GetAnswerValue("RodentOrigin") 
				if rodOrigin = "Y" then
	                newTumorLine.RodentOrigin = refCodes.GetRefCode("ANIMCELLRODSOURCE", questionnaireAnswer.GetAnswerValue("RodSource")).Meaning
	                if newTumorLine.RodentOrigin = "Other" then
	                    newTumorLine.OriginOther = questionnaireAnswer.GetAnswerValue("OtrSpecies")
	                end if
				else
	                newTumorLine.RodentOrigin = refCodes.GetRefCode("ANIMCELLNONRODSOURCE", questionnaireAnswer.GetAnswerValue("NonRodSource")).Meaning
	                if newTumorLine.RodentOrigin = "Other" then
	                    newTumorLine.OriginOther = questionnaireAnswer.GetAnswerValue("NonOtrSpecies")
	                end if
				end if

				Dim answerValue as string
				answerValue = questionnaireAnswer.GetAnswerValue("PassRod") 
				If answerValue = "Y" Then
                    newTumorLine.passRodent = true
                Else
                    newTumorLine.passRodent = false
                End If
			
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Procedures
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			Else If (qV.Questionnaire.Name = "Procedures") Then
			
                    Dim refCodes as CDS.RefCodes = new CDS.RefCodes(cachePolicy)
                    refCodes.Load(connectionString, Nothing)

			        Dim newProcedure as AnimalsRexParams.Procedure = new AnimalsRexParams.Procedure
				    rexParams.Procedures.Add (newProcedure)
    				
				    'Dim answers as new ArrayList()
				    answers = questionnaireAnswer.GetAnswers("ProcName")
    				
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("Surgical")
				    If ( answers.Count > 0) Then
				        Dim surgType as FormsManagement.Answer = answers(0)
				        If surgType.Value = "Surgical" Then
				            newProcedure.SurgicalType = surgType.Value
                            Dim surgicalAnswers as ArrayList = questionnaireAnswer.GetAnswers("SurgName")
                            if surgicalAnswers.Count > 0 then
                                newProcedure.SurgName = refCodes.GetRefCode("ANIMPROCEDURE", surgicalAnswers(0).Value).Meaning
                            end if
				        Else If surgType.Value = "Non" Then
				            newProcedure.SurgicalType = "Non-Surgical"
                            Dim procedureAnswers as ArrayList = questionnaireAnswer.GetAnswers("ProcName")
                            if procedureAnswers.Count > 0 then
                               newProcedure.SurgName = refCodes.GetRefCode("ANIMPROCEDURE", procedureAnswers(0).Value).Meaning
                            end if
				        End If
    				    
				    End If 
				
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("Survival")
				    If ( answers.Count > 0) Then
				        Dim survival as FormsManagement.Answer = answers(0)
				        If survival.Value = "Survival" Then
				            newProcedure.Survival = survival.Value
				        Else If survival.Value = "Non" Then
				            newProcedure.Survival = "Non-Survival"
				        End If    				   
				    End If 
				    
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("Build")
				    If ( answers.Count > 0) Then
				        Dim procBuilding as FormsManagement.Answer = answers(0)
				        If not procBuilding.Value is nothing or procBuilding.Value <> string.empty Then
				           newProcedure.Building = procBuilding.Value
				        End If    				   
				    End If 	
				    
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("Room")
				    If ( answers.Count > 0) Then
				        Dim procRoom as FormsManagement.Answer = answers(0)
				        If not procRoom.Value is nothing or procRoom.Value <> string.empty Then
				           newProcedure.Room = procRoom.Value
				        End If    				   
				    End If 

			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Tissues
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			Else If (qV.Questionnaire.Name = "Tissue") Then
			
			        Dim newTissue as AnimalsRexParams.Tissue = new AnimalsRexParams.Tissue
				    rexParams.Tissues.Add (newTissue)
    				
				    'Dim answers as ArrayList
				    answers = questionnaireAnswer.GetAnswers("Type")
				    If ( answers.Count > 0) Then
				        Dim tissueType as string = answers(0).value

				        For each questionnaireItem as FormsManagement.QuestionnaireItem in qv.Items
				    	    if ( questionnaireItem.Name = "Type") then
				    		    for each itemOption as FormsManagement.ItemOption in  questionnaireItem.Options
				    			    if (itemOption.OptionValue = tissueType) then
				    				    newTissue.Type = itemOption.OptionText
				    				    exit for
				    			    end if
				    		    next
							    exit for
						    end if
				        Next
				    End If 
				
				    answers = questionnaireAnswer.GetAnswers("Source")
				    If ( answers.Count > 0) Then
				        'If "INT" is selected in question name "Source", then "Protocol" is selected in source column in Rex and the answers given to insight question "ProtNum" populates "Protocol/Vendor Name".  
					    newTissue.Source = "Protocol"
					    answers = questionnaireAnswer.GetAnswers("ProtNum")
					    if (answers.Count > 0) Then
						    newTissue.VendorName = answers(0).Value
					    End If
				    End If 
				
				    answers = questionnaireAnswer.GetAnswers("ColSource")
				    If ( answers.Count > 0) Then
					    'If "COL" is checked in insight question name "ColSource", then "Protocol" is selected in source column in Rex.  The answer given to insight "ColInfo" populates "Protocol Contact" in Rex.
					    newTissue.Source = "Protocol"
					    answers = questionnaireAnswer.GetAnswers("ColInfo")
					    if (answers.Count > 0) Then
						    newTissue.ProtocolContact = answers(0).Value
					    End If
				    End If	
				
				    answers = questionnaireAnswer.GetAnswers("BSHSource")
				    If ( answers.Count > 0) Then
					    'If "BSH" is checked in insight question name "BSHSource, then "Vendor" is selected in source column in Rex.  The answer given to insight "Company" populates "Protocol/Vendor Name" in Rex.
					    newTissue.Source = "Vendor"
					    answers = questionnaireAnswer.GetAnswers("Company")
					    if (answers.Count > 0) Then
						    newTissue.VendorName = answers(0).Value
					    End If
				    End If
				
				    answers = questionnaireAnswer.GetAnswers("OTRSource")
				    If ( answers.Count > 0) Then
					    'If "OTR" is checked in insight question name "OtrSource" then "Vendor" is selected in source column in Rex.  The answer given to insight "Other" populates "Protocol Contact" in Rex.
					    newTissue.Source = "Vendor"
					    answers = questionnaireAnswer.GetAnswers("Other")
					    if (answers.Count > 0) Then
						    newTissue.ProtocolContact = answers(0).Value
					    End If
				    End If	
				
				
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Abstract  TODO: Add in the questions here...
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			Else If ( qV.Questionnaire.Name = "Abstract") Then
			
			        'Dim answers as new ArrayList()
			        answers = questionnaireAnswer.GetAnswers("Objective")
			        If (answers.Count > 0) Then
			            Dim objective as FormsManagement.Answer = answers(0)
    			        
			            'Get the text of the questionnaire
			            Dim questItem As FormsManagement.QuestionnaireItem
					    For Each questItem In qV.Items
			                if ( questItem.Name = "Objective") then
			                    rexParams.Objective = questItem.HtmlStrippedText
			                    rexParams.Objective += vbCrLf 
			                    exit for
			                end if
			            Next
			            rexParams.Objective += objective.Value
			        End If
			    
			        answers = nothing
			        answers = questionnaireAnswer.GetAnswers("Significance")
				    If (answers.Count > 0) Then
			            Dim significance as FormsManagement.Answer = answers(0)
    			        
			            'Get the text of the questionnaire
			            Dim questItem As FormsManagement.QuestionnaireItem
					    For Each questItem In qV.Items
			                if ( questItem.Name = "Significance") then
			                    rexParams.Significance = questItem.HtmlStrippedText
			                    rexParams.Significance += vbCrLf
			                    exit for
			                end if
			            Next
    			        
			            rexParams.Significance += significance.Value
			        End If
				
				    answers = nothing
				    answers = questionnaireAnswer.GetAnswers("SimExp")
			        if (answers.Count > 0 ) Then
			            Dim simExp as FormsManagement.Answer = answers(0)
    			        
			            'Get the text of the questionnaire
			            Dim questItem As FormsManagement.QuestionnaireItem
					    For Each questItem In qV.Items
			                if ( questItem.Name = "SimExp") then
			                    rexParams.SimExp = questItem.HtmlStrippedText
			                    rexParams.SimExp += vbCrLf
    			                
			                    exit for
			                end if
			            Next
    			        rexParams.SimExp += simExp.Value
    			    End If
			    
			        answers = nothing
			        answers = questionnaireAnswer.GetAnswers("Prior")
			        if ( answers.Count > 0 ) Then
			            Dim prior as FormsManagement.Answer = answers(0)
    			        
			            'Get the text of the questionnaire
			            Dim questItem As FormsManagement.QuestionnaireItem
					    For Each questItem In qV.Items
			                if ( questItem.Name = "Prior") then
			                    rexParams.Prior = questItem.HtmlStrippedText
			                    rexParams.Prior += vbCrLf
			                    exit for
			                end if
			            Next    			        
			            rexParams.Prior += prior.Value
			        End If
			    
			        answers = nothing
			        answers = questionnaireAnswer.GetAnswers("Endpoints")
			        if ( answers.Count > 0 ) Then
			            Dim endpoints as FormsManagement.Answer = answers(0)
    			        
			            'Get the text of the questionnaire
			            Dim questItem As FormsManagement.QuestionnaireItem
					    For Each questItem In qV.Items
			                if ( questItem.Name = "Endpoints") then
			                    rexParams.Endpoints = questItem.HtmlStrippedText
			                    rexParams.Endpoints += vbCrLf
			                    exit for
			                end if
			            Next    			        
			            rexParams.Endpoints += endpoints.Value
			        End IF
			 			
				
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			'' Hazardous Agent Administration and Use
			'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
			Else If (qV.Questionnaire.Name = "Hazardous Agent Administration and Use") Then	

                    Dim newHazardousAgent as AnimalsRexParams.HazardousAgent = new AnimalsRexParams.HazardousAgent
				    rexParams.HazardousAgents.Add (newHazardousAgent)
    				
				    'Dim answers as new ArrayList()
				    answers = questionnaireAnswer.GetAnswers("HazardType") 
				    If (answers.Count > 0) Then
				        Dim hazType as FormsManagement.Answer = answers(0)
				        newHazardousAgent.HazardType = hazType.Value
				        select case hazType.Value
						    case "Bio"
							    Dim bioBoardReview as AnimalsRexParams.BoardReview = new AnimalsRexParams.BoardReview
							    rexParams.BoardReviews.Add (bioBoardReview)
							    bioBoardReview.Period = 1
							    bioBoardReview.DocumentType = "Initial Review"
							    bioBoardReview.MailGroupId = 170 'Biosafety MailGroupId
							    bioBoardReview.ReviewType = ""
							    bioBoardReview.BoardStatus = "Pending"
							    overallStatus = Replace(overallStatus, "Pending ", "Pending Biosafety, ")
							    bioBoardReview.OverallStatus = overallStatus
							    bioBoardReview.CurrentStatus = true
							    bioBoardReview.Note = ""
							    bioBoardReview.RTFNote = ""
							    bioBoardReview.StaffNote = ""
							    bioBoardReview.StaffNoteRTF = ""
						    case "Rad"
					            Dim radBoardReview as AnimalsRexParams.BoardReview = new AnimalsRexParams.BoardReview
							    rexParams.BoardReviews.Add (radBoardReview)
							    radBoardReview.Period = 1
							    radBoardReview.DocumentType = "Initial Review"
							    radBoardReview.MailGroupId = 169 'Radiation Safety MailGroupId
							    radBoardReview.ReviewType = ""
							    radBoardReview.BoardStatus = "Pending"
							    overallStatus = Replace(overallStatus, "IACUC", "IACUC, Radiation Safety")
							    radBoardReview.OverallStatus = overallStatus
							    radBoardReview.CurrentStatus = true
							    radBoardReview.Note = ""
							    radBoardReview.RTFNote = ""
							    radBoardReview.StaffNote = ""
							    radBoardReview.StaffNoteRTF = ""
						    case "Chem"
					            Dim chemBoardReview as AnimalsRexParams.BoardReview = new AnimalsRexParams.BoardReview
							    rexParams.BoardReviews.Add (chemBoardReview)
							    chemBoardReview.Period = 1
							    chemBoardReview.DocumentType = "Initial Review"
							    chemBoardReview.MailGroupId = 171 'Safety (Chemical) MailGroupId
							    chemBoardReview.ReviewType = ""
							    chemBoardReview.BoardStatus = "Pending"
							    if (InStr(overallStatus, "Radiation Safety") > 0)
								    overallStatus = Replace(overallStatus, "Radiation Safety", "Radiation Safety, Safety")
							    else
								    overallStatus = Replace(overallStatus, "IACUC", "IACUC, Safety")
							    end if
							    chemBoardReview.OverallStatus = overallStatus
							    chemBoardReview.CurrentStatus = true
							    chemBoardReview.Note = ""
							    chemBoardReview.RTFNote = ""
							    chemBoardReview.StaffNote = ""
							    chemBoardReview.StaffNoteRTF = ""    						
				        end select
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Building") 
				        If (answers.Count > 0) Then
				            Dim buildingAnswer As FormsManagement.Answer
					        For Each buildingAnswer In answers
					            if  buildingAnswer.Value = "114CNY1"  Then
						            newHazardousAgent.Building.Add ( "114" )	
						        else if  buildingAnswer.Value = "149CNY8"  Then
						            newHazardousAgent.Building.Add ( "149-8" )	
						        else if  buildingAnswer.Value = "149CNY9"  Then
						            newHazardousAgent.Building.Add ( "149-9" )	
						        else if  buildingAnswer.Value = "65LANDS"  Then
						            newHazardousAgent.Building.Add ( "65LANDS" )
						        else if  buildingAnswer.Value = "COX7"  Then
						            newHazardousAgent.Building.Add ( "COX-7" )	
						        else if  buildingAnswer.Value = "EDWARDS6"  Then
						            newHazardousAgent.Building.Add ( "EDR-6" )	
						        else if  buildingAnswer.Value = "SHRINERS"  Then
						            newHazardousAgent.Building.Add ( "SBI" )	
						        else if  buildingAnswer.Value = "SIMCHES8"  Then
						            newHazardousAgent.Building.Add ( "CPZ-8" )	 
						        else if  buildingAnswer.Value = "THIER8"  Then
						            newHazardousAgent.Building.Add ( "Thier-8" )	
						        else if  buildingAnswer.Value = "THIERB1"  Then
						            newHazardousAgent.Building.Add ( "Thier-B" )
						        else if  buildingAnswer.Value = "WHITE5"  Then
						            newHazardousAgent.Building.Add ( "WHT-5" )
						        else if  buildingAnswer.Value = "CNY75"  Then
						            newHazardousAgent.Building.Add ( "75" )
						        else if  buildingAnswer.Value = "114CNY1"  Then
						            newHazardousAgent.Building.Add ( "114" )	
						        end if			    
				            Next
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Room")
				        If (answers.Count > 0) Then
				            Dim roomAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Room = roomAnswer.Value
				        End If
				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Dose")
				        If (answers.Count > 0) Then
				            Dim doseAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Dose = doseAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Route")
				        If (answers.Count > 0) Then
				            Dim routeAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Route = routeAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("TotalDoses")
				        If (answers.Count > 0) Then
				            Dim totalDosesAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.TotalDoses = totalDosesAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Duration")
				        If (answers.Count > 0) Then
				            Dim durationAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Duration = durationAnswer.Value
				        End If
				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Manipulations")
				        If (answers.Count > 0) Then
				            Dim manipulationsAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Manipulations = manipulationsAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Isotope")
				        If (answers.Count > 0) Then
				            Dim isotopeAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Isotope = isotopeAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("PermitNum")
				        If (answers.Count > 0) Then
				            Dim permitNumAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.PermitNum = permitNumAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("PermitName")
				        If (answers.Count > 0) Then
				            Dim permitNameAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.PermitName = permitNameAnswer.Value
				        End If
				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Frequency")
				        If (answers.Count > 0) Then
				            Dim frequencyAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Frequency = frequencyAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Chem")
				        If (answers.Count > 0) Then
				            Dim chemAnswer As FormsManagement.Answer = answers(0)
				            newHazardousAgent.Chemical = chemAnswer.Value
				        End If
        				
				        answers = nothing
				        answers = questionnaireAnswer.GetAnswers("Bio")
				        If (answers.Count > 0) Then
				            Dim bioAnswer as FormsManagement.Answer = answers(0)
				            newHazardousAgent.BioAgent = bioAnswer.Value
				        End If		
		    	End If			 
			
	    Next
            
    end sub	
    
    sub AddArrayListItem( byval qa as FormsManagement.QuestionnaireAnswer, byval answerName as string, byval answerValue as string, byref list as ArrayList, byval itemToAdd as string )
        Dim answers as ArrayList = qa.GetAnswers(answerName)
        if ( answers.Count > 0 ) then
            if ( answers(0).Value = answerValue ) then
                list.Add( itemToAdd )
            end if
        end if
    end sub
end module